<template>
  <div class="gqgLoad" v-show="show">
    <div class="gqgMask"></div>
    <div class="gqgCont">
      <div class="gqgAnimate"></div>
      <div class="gqgText">{{ text }}</div>
    </div>
  </div>
</template>
<script>
export default {
  name: "gqgLoad",
  props: {
    show: Boolean,
    text: {
      type: String,
      default: "正在加载中",
    },
  },
  watch: {
    show(newVal) {
      if (newVal == true) {
        document.body.parentNode.style.overflow = "hidden"; //禁止横竖向滚动条
      } else {
        document.body.parentNode.style.overflow = "inherit"; //恢复横竖向滚动条
      }
    },
  },
  methods: {},
};
</script>
<style lang="less" scoped>
.gqgLoad {
  text-align: center;
  .gqgMask {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
  }
  .gqgCont {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1001;
    color: #fff;
    .gqgAnimate {
      width: 40px;
      height: 40px;
      margin: 25px 0 10px 0;
      animation: cricleLoading 1s steps(12, end) infinite;
      background: transparent
        url("")
        no-repeat;
      background-size: 100%;
    }
  }
}
@-webkit-keyframes cricleLoading {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}
@keyframes cricleLoading {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}
</style>
